<template>
  <el-button :type="type" :icon="useIcon" :size="size" v-bind="$attrs" v-on="$listeners">
    <slot />
  </el-button>
</template>

<script>
export default {
  name: 'MyButton',
  props: {
    type: { type: String, default: 'default' },
    icon: { type: String, default: '' },
    size: { type: String, default: 'medium', validator: (val) => ['default', 'medium', 'small', 'mini'].indexOf(val) !== -1 }
  },
  data() {
    return {

    }
  },
  computed: {
    useIcon() {
      return this.icon ? `el-icon-${this.icon}` : ''
    }
  }
}
</script>

<style>

</style>
